package com.aaa.dem1104.d01;

import java.util.function.Supplier;

/**
 * @Author: whj
 * @Version 1.0
 * @Date: 2022/11/4  10:16
 */

/**
 * 实例方法引用
 */
public class Test2 {
    public static void main(String[] args) {

        //无参，返回学生对象的名称
        Student s=new Student("汪豪杰","郑州");
        //观察该lambda表达式: 对象名.实例方法（）。
        //方法引用
        Supplier<String> supplier=s::getName;
        System.out.println(supplier.get());
    }
}

class Student{
    private String name;
    private String address;

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getAddress() {
        return address;
    }

    public void setAddress(String address) {
        this.address = address;
    }

    public Student(String name, String address) {
        this.name = name;
        this.address = address;
    }
}
